import getApiData from "@/services/cpasRequest";
import notify from 'devextreme/ui/notify';



// 获取指定账套ID的科目的节点的上级节点
export async function getSubjectParentList(params: {
  dbname: string;
  Data_ID: string;
  PKMBH: string;
}) {
  const res = await getApiData("account.subject.getDataParentList", params);
  return Promise.resolve({
    data: res.data,
    success: res.ok,
  });
}


// 获取左侧树数据
export async function getSubjectList(params: {
  dbname: string;
  Data_ID: string;
  isHasFZZ?: boolean;
}) {
  const res = await getApiData("account.subject.getDataList", params);
  return Promise.resolve({
    data: res.data,
    success: res.ok,
  });
}



// 获取左侧切换的数据
export async function getSubjectType(params: {
  dbname: string;
  Data_ID: string
}) {
  const res = await getApiData("account.subject.getType", params);
  return Promise.resolve({
    data: res.data,
    success: res.ok,
  });
}



// 获取审计调整新单据编号
export async function getReportItemsData(params: {
  dbname: string;
  Data_ID: string;
  userCode: string | undefined
}) {
  const res = await getApiData("account.ZBAdujst.getNewBillNo ", params);
  if (res.ok) {
    return res.data;
  }
  return {};
}

// 获取账套
export async function getAccountInfo(params: {
  dbname: string;
}) {
  if (!params.dbname) return [];
  const res = await getApiData("account.accountInfo.getDataList", params);
  if (res.ok) {
    return Promise.resolve({
      data: res.data,
      success: true,
    });
  }
  return Promise.resolve({
    data: [],
    success: false,
  });
}